[Chapter 23] 23.4 Printing the Queue
Author: Bryan Costales & Eric Allman
Date: 1999-01-06T19:32:44Z

#

| Chapter 23 The Queue |

## 23.4 Printing the Queue

When sendmail is run under the name mailq, or when it is given the `-bp` command-line switch, it prints the contents of the queue and exits.

Before printing the queue's contents, sendmail prereads all the `qf` files in the queue and sorts the mail messages internally. This is done so that the queue's contents are displayed in the same order in which the messages will be processed during a queue run.

If there are no messages in the queue (no `qf` files), sendmail prints the following message and exits:

>     Mail queue is empty

Otherwise, sendmail prints the number of messages (number of `qf` files) in the queue:

>     Mail Queue (# requests)

The `#` is the number of queued messages (requests) in the queue directory. If there are more than the maximum number of messages that may be processed at one time (defined by the `MaxQueueRunSize` option (see Section 34.8.38, MaxQueueRunSize), [4] sendmail prints

> [4] Prior to V8.7 this was determined by defining QUEUESIZE in conf.h.

>     Mail Queue (# requests, only ## printed)

The `##` is the value of the `MaxQueueRunSize` option.

Next, sendmail prints an attractive heading that looks like the following:

>     -Q-ID- -Size- ---Q-Time--- ------Sender/Recipient------
>     MAA12345      354 Fri Mar 15 08:32 your@your.domain
>                                        george@wash.dc.gov
>     MAA12346*    1972 Fri Mar 15 08:45 your@your.domain
>           8BITMIME   (Timed out waiting to connect to wash.dc.gov)
>                                        jefferson@wash.dc.gov
>     MAA12347-      23 Fri Mar 15 09:32 your@your.domain
>                      (Timed out waiting to connect to wash.dc.gov)
>                                        jefferson@wash.dc.gov
>                                        bob

The heading shows the information that is printed about each message in the queue. The items in that heading and their meanings are the following: `Q-ID` The queue identifier for the message: the hour character, the clocked `AA` part, and the `pid` numeric part (like `MAA12345`). This item can be followed by a character showing the item's status. An asterisk (`*` as in the second item above), means that the message is locked (an `lf` file was found or the `qf` file is locked depending on the kind of locking your version of sendmail uses). An `X` means that the load average is currently too high to allow delivery of the message. A minus (`-` as in the third item above) means that the message is too young to be processed (based on the `MinQueueAge` option, see Section 34.8.41, MinQueueAge). `Size` The size in bytes of the `df` file. If there is no `df` file (because sendmail is currently receiving this message and hasn't created one yet), this item is absent. If the message has completed processing, this prints as:

>     (job completed)

If the `qf` file is empty, this prints as

>     (no control file)

`Q-Time` The date and time that the message was first placed into the queue. This is the `T` line (see Section 23.9.15, T line) in the `qf` file converted from an unsigned integer into a more understandable date and time. `Sender` The sender of the message as taken from the `S` line (see Section 23.9.14, S line) in the `qf` file. Only the first 45 characters of the sender address are printed. If there is a `B` line (see Section 23.9.1, B line) in the `qf` file (as the 8BITMIME in the second item in the example above) sendmail prints that body-type (see the `-B` switch in Section 36.7.1, -B) on the line following the sender. If there is an `M` line (see Section 23.9.9, M line) in the `qf` file, sendmail prints the text of the error message in parentheses. `Recipient` After all of the above items have been printed, a list of the recipients (from each `R` line, see Section 23.9.13, R line, in the `qf` file) is printed in the order in which they are found. In the above example there is one recipient for each of the first two items and two recipients for the last item.

### 23.4.1 Printing the Queue in Verbose Mode

The `-v` command-line switch may be used in combination with the `-bp` switch to cause sendmail to also print additional details about the queued messages. To begin, the usual heading shows a new item:

>     -Q-ID- -Size- -Priority- --Q-Time-- ------Sender/Recipient------
>     MAA12345      354      30020 Fri Mar 15 08:32 your@your.domain
>                                        george@wash.dc.gov
>     MAA12346*    1972      48764 Fri Mar 15 08:45 your@your.domain
>           8BITMIME   (Timed out waiting to connect to wash.dc.gov)
>                                        jefferson@wash.dc.gov
>     MAA12347-      23      54321+Fri Mar 15 09:32 your@your.domain
>                      (Timed out waiting to connect to wash.dc.gov)
>                                        jefferson@wash.dc.gov
>                                    (--you--)
>                                        bob

The `Priority` is the value from the `P` line (see Section 23.9.11, P line) in the `qf` file. Printing the queue does not change a message's priority, whereas processing the queue does. See the `RecipientFactor` (`y`) option (Section 34.8.53, RecipientFactor (y)) for a description of how the priority is calculated.

Verbose mode also causes a `+` to print after the `Priority` (as in the third item above) if a warning message has been sent. See the `Timeout.queuewarn` option (Section 34.8.70, Timeout (r)) for a description of how messages time out.

If any `R` line is preceded by a controlling user (`C` line in the `qf` file; see Section 23.9.2, C line), verbose mode causes that controlling user's name to be put in parentheses and prepended to the recipient name. The third item in the preceding example illustrates this.

Finally, the `M` line error messages are normally truncated to 60 characters. Beginning with V8.8 sendmail, verbose mode causes the full, nontruncated text of the `M` line error to be printed.

23.3 A Bogus qf File (V8 only): Qf |  | 23.5 How the Queue Is Processed